package change;

import objects.CarBase;
import objects.CarNodeStore;

import java.util.List;

/**
 * @author web
 * 本方法用于迭代中车辆的移动
 */
public class ChangeMove {
    public static void updateMove(CarNodeStore carNodeStore, double t) {
        List<CarBase> list = carNodeStore.getCarList();
        for (CarBase carBase : list) {
            carBase.setX(carBase.getX() + carBase.getV() * t + 0.5 * carBase.getA() * carBase.getA());
            carBase.setV(carBase.getV() + t * carBase.getA());
        }
        carNodeStore.setCarList(list);
    }
}
